package Demo;

import java.util.Scanner;

public class Demo1 {

    public static int getLongestPalindrome (String A) {
        if(A==null)return 0;
        char[]ch=A.toCharArray();
        int n=A.length();
        int max=1;
        for (int i = 0; i <n ; i++) {
            int count=1;
            int l=i-1;
            int r=i+1;
            while(l>=0&&r<n){
                if(ch[l]==ch[r]){
                    count+=2;
                    l--;
                    r++;
                    max=Math.max(count,max);
                }else break;
            }
        }
        return max;
    }

    public static void main(String[] args) {
        String s="b";
        System.out.println(getLongestPalindrome(s));

    }


    public static void main5(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int m=scanner.nextInt();
        int n=scanner.nextInt();
        int x=scanner.nextInt()+1;
        int y=scanner.nextInt()+1;

        int [][]dp=new int[m+2][n+2];
        dp[0][1]=1;
        for (int i = 1; i <=m+1 ; i++) {
            for (int j = 1; j <=n+1 ; j++) {
                if((!(i==x||j==y)&&(Math.abs(x-i)+Math.abs(y-j)==3))||(i==x&&j==y))dp[i][j]=0;
                else dp[i][j]=dp[i-1][j]+dp[i][j-1];
            }
        }
        System.out.println(dp[m+1][n+1]);
    }


    public static void main4(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int n=scanner.nextInt();
        int []num=new int[n];
        for (int i = 0; i <n ; i++) {
            num[i]=scanner.nextInt();
        }
        int []f=new int[n];
        int []g=new int[n];
        f[0]=-num[0];
        g[0]=0;
        for (int i = 1; i <n ; i++) {
            f[i]=Math.max(f[i-1],-num[i]);
            g[i]=Math.max(f[i-1]+num[i],g[i-1]);
        }
        System.out.println(g[n-1]);
    }



    public static boolean IsContinuous (int[] numbers) {
       int []num=new int[14];
        for (int i = 0; i <numbers.length ; i++) {
            num[numbers[i]]++;
        }
        if (num[0]==5)return true;
        int i=1;
        int j=13;
        while(num[i]==0||num[j]==0){
            if(num[i]!=0&&num[j]==0)j--;
            else if(num[j]!=0&&num[i]==0)i++;
            else {
                j--;
                i++;
            }
        }
        int count=0;
       while(i<=j){
           if(num[i]>1)return false;
           if(num[i]==0)count++;
           i++;
       }
        if(count==num[0])return true;
        else return false;
    }

    public static void main3(String[] args) {
        int[]num={6,0,2,0,4};
        System.out.println(IsContinuous(num));
    }


    public static void main2(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int n=scanner.nextInt();
        int []dp=new int[n+2];
        dp[0]=0;
        dp[1]=1;
        for (int i = 2; i <=n+1 ; i++) {
            dp[i]=dp[i-1]+dp[i-2];
        }
        System.out.println(dp[n+1]);
    }

    public static void main1(String[] args) {
        Scanner scanner=new Scanner(System.in);
        String s=scanner.next();
        StringBuffer sb=new StringBuffer();
        int count=0;
        for (int i = s.length()-1; i>=0 ; i--) {
            sb.append(s.charAt(i));
         if(count%3==2&&i!=0){
             sb.append(',');
         }
         count++;
        }
        System.out.println(sb.reverse());
    }
}
